package com.lbm.business.service.impl;

import java.util.List;
import com.lbm.baseclass.exception.ServiceException;
import com.lbm.baseclass.service.impl.BaseServiceImpl;
import com.lbm.business.service.IRoleModuleService;
import com.lbm.model.RoleModule;

public class RoleModuleServiceImpl  extends BaseServiceImpl implements IRoleModuleService{
	/**
	 * 通过HQL构造查询条件来查询符合条件的UserModule信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getRoleModuleByHQL(String hql) throws ServiceException {
		return baseDAO.getValueObjectsByHQL(hql);
	}
	/**
	 * 根据主键查询UserModule信息明细
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public RoleModule getRoleModuleById(String id) throws ServiceException {
		RoleModule roleModule=null;
		List list=baseDAO.getValueObjectsByHQL(" from RoleModule where roleid='"+id+"'");
		if(!list.isEmpty()&&list.size()>0){
			roleModule=(RoleModule)list.get(0);
		}
		return roleModule;
	}
	/**
	 * 查询所有的UserModule信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getAllRoleModule() throws ServiceException {
		return baseDAO.getValueObjectsByHQL(" from RoleModule");
	}
	/**
	 * 新增、修改UserModule信息
	 * 
	 * @param UserModule
	 * @throws DataAccessException
	 */
	@Override
	public void saveOrUpdateRoleModule(RoleModule roleModule) throws ServiceException {
		baseDAO.saveOrUpdateVO(roleModule);
	}
	/**
	 * 删除UserModule信息
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public void deleteRoleModule(String id) throws ServiceException {
		RoleModule userModule=this.getRoleModuleById(id);
		baseDAO.deleteVO(userModule);
	}
}
